package com.cloud.applet.controller;

import com.alibaba.fastjson.JSONObject;
import com.cloud.applet.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/common")
public class CommonController {

    @Autowired
    private UserService service;


    @RequestMapping("/getAddress")
    public JSONObject getAddress(@RequestBody String owner){
        JSONObject jsonObject = JSONObject.parseObject(owner);
        JSONObject object = service.getAddress(jsonObject);
        return object;
    }

    @RequestMapping("/updateAddress")
    public JSONObject updateAddress(@RequestBody String owner){
        JSONObject jsonObject = JSONObject.parseObject(owner);
        JSONObject object = service.updateAddress(jsonObject);
        return object;
    }

    @RequestMapping("/deleteAddress")
    public JSONObject deleteAddress(@RequestBody String owner){
        JSONObject jsonObject = JSONObject.parseObject(owner);
        JSONObject object = service.deleteAddress(jsonObject);
        return object;
    }


    @RequestMapping("/getGoodsList")
    public JSONObject getGoodsList(@RequestBody String owner){
        JSONObject jsonObject = JSONObject.parseObject(owner);
        JSONObject object = service.getGoodsList(jsonObject);
        return object;
    }

    @RequestMapping("/getGoodsById")
    public JSONObject getGoodsById(@RequestBody String owner){
        JSONObject jsonObject = JSONObject.parseObject(owner);
        JSONObject object = service.getGoodsById(jsonObject);
        return object;
    }

    @RequestMapping("/getOrderList")
    public JSONObject getOrderList(@RequestBody String owner){
        JSONObject jsonObject = JSONObject.parseObject(owner);
        JSONObject object = service.getOrderList(jsonObject);
        return object;
    }

    @RequestMapping("/deleteShopCar")
    public JSONObject deleteShopCar(@RequestBody String owner){
        JSONObject jsonObject = JSONObject.parseObject(owner);
        JSONObject object = service.deleteShopCar(jsonObject);
        return object;
    }


    @RequestMapping("/addBag")
    public JSONObject addBag(@RequestBody String owner){
        JSONObject jsonObject = JSONObject.parseObject(owner);
        JSONObject object = service.addBag(jsonObject);
        return object;
    }


    @RequestMapping("/getShopCarList")
    public JSONObject getShopCarList(@RequestBody String owner){
        JSONObject jsonObject = JSONObject.parseObject(owner);
        JSONObject object = service.getShopCarList(jsonObject);
        return object;
    }






}
